import java.util.Scanner;

public class 动态求连续区间和 {
    static int N = 100010;
    static int[] arr  = new int[N];
    static int[] tree = new int[N];
    public static void main(String[] args) {
    Scanner s = new Scanner(System.in);
    int n = s.nextInt();
    int m = s.nextInt();
    for (int i = 1; i <=n ; i++)  arr[i] = s.nextInt();
    for (int i = 1; i <=n ; i++) addArray(i,arr[i]);

    while(m-- >0) {
        int a = s.nextInt();
        int b = s.nextInt();
        int c = s.nextInt();
        if (a == 0) System.out.println(sumArray(c) - sumArray(b-1) );
        else addArray(b, c);
    }
    }
    private static int lowBit(int x) {
        return x & -x;
    }
    private static int sumArray(int a ){
        int sum = 0;
        for (int i = a; i >0 ; i-=lowBit(i))  sum+=tree[i];
        return sum;
    }
    private static void addArray(int l,int add) {
        for (int i = l; i <=arr.length ; i+=lowBit(i))  tree[i]+=add;
    }

}
